package com.teamone.etl.dataruleengine.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.github.pagehelper.PageInfo;
import com.teamone.etl.dataruleengine.dto.RuleEngineReq;
import com.teamone.etl.dataruleengine.entity.RuleEngine;

import java.io.IOException;

/**
 * (RuleEngine)表服务接口
 *
 * @author makejava
 * @since 2021-01-12 21:04:40
 */
public interface RuleEngineService extends IService<RuleEngine> {

    /**
     * 模糊分页查询
     *
     * @param codeTypeId    规则类型id
     * @param name          规则名称
     * @param functionName  类/函数名称
     * @param page          当前页
     * @param size          每页显示条数
     * @return 部分数据
     */
    PageInfo<RuleEngine> ruleSearch(String codeTypeId, String name, String functionName, Integer page, Integer size);

    /**
     * 修改
     *
     * @param ruleEngineReq 规则引擎对象
     * @return Boolean 更新成功/失败
     */
    Boolean updateRuleEngine(RuleEngineReq ruleEngineReq);

    /**
     * 回显
     *
     * @param id 主键
     * @return 规则引擎对象
     */
    RuleEngine getRuleEngineById(Integer id);

    /**
     *  删除
     * @param id   主键id
     * @throws IOException
     */
    void delRuleEngineById(Integer id) throws IOException;

    /**
     * 添加规则
     * @param ruleEngine
     * @return
     * @throws IOException
     */
    boolean addRuleEngine(RuleEngine ruleEngine) throws IOException;
    /**
     * 编译java代码
     * @param ruleEngine
     * @param codes
     * @return
     * @throws IOException
     */
    boolean compileJava(RuleEngine ruleEngine, String codes) throws IOException;

    /**
     * 编译sql
     * @param ruleEngine
     * @return
     * @throws IOException
     */
    boolean execute(RuleEngine ruleEngine) throws IOException;
}